<?php
$db = Database::getInstance();
if(isset($_POST['id'])) {
$result=$db->query("UPDATE user_rights SET level='".$_POST['droits']."' WHERE id_user='".$_POST['id']."'");
	header('Location:'.$URL_PATH.'rights.php');							
}
else{

$idd = strstr($_POST['nom'], '(');
$id=str_replace(')','',$idd);
$id=str_replace('(','',$id);
$result=$db->query("INSERT INTO user_rights (id_user,level) VALUES ('".$id."' ,'".$_POST['droits']."')");
header('Location:'.$URL_PATH.'rights.php');
}


?>